package net.esj.basic.core.engine.tools.crypt;


public class CryptUtils {

	private static MD5CryptImpl crypt = new MD5CryptImpl();
	
	public static final byte[] generateSecretKey(byte[] inbytes,int size){
		byte[] bytes = crypt.encrypt(inbytes);
		byte[] ret = new byte[size];
		int max = bytes.length;
		int k = 0;
		for(int i=0;i<size;i++){
			if(k<max){
				ret[i] = bytes[k];
				k++;
			}else{
				k = 0; 
				ret[i] = bytes[k];
			}
		}
		return ret;
	}
}
